//package com.taven.javaagent.javassist;
//
//import javassist.ClassPool;
//import javassist.CtClass;
//import javassist.CtMethod;
//import javassist.LoaderClassPath;
//
//import java.io.ByteArrayInputStream;
//
//public class JavassistDemo {
//
//    public static void main(String[] args) {
//
//        //byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
//
//        ClassPool classPool = ClassPool.getDefault();
//        classPool.appendClassPath(new LoaderClassPath(loader));
//        classPool.appendSystemPath();
//        try {
//            CtClass ctClass = classPool.makeClass(new ByteArrayInputStream(classfileBuffer));
//            CtMethod[] declaredMethods = ctClass.getDeclaredMethods();
//            for (CtMethod declaredMethod : declaredMethods) {
//                declaredMethod.insertBefore("System.out.println(\"before invoke"+ declaredMethod.getName() + "\");");
//            }
//            //return ctClass.toBytecode();
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//
//}
